<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/core" prefix="c"%>		
<%@ taglib uri="/tags/fmt" prefix="fmt"%>
<span id="materialDescriptionAjax">
	<logic:present name="ProductView">
		<input type="text" name="ipdView.itemDescription" size="27" value="<bean:write name="ProductView"  property="description"/>"   readonly="true" class="campo_texto" id="productDescriptionForm"/> 
	</logic:present>
	<logic:notPresent  name="ProductView">
		<input type="text" name="ipdView.itemDescription" size="27" value=""   readonly="true" class="campo_texto" id="productDescriptionForm"/> 
	</logic:notPresent>
</span>
<span id="periodForecast">
	<table width="95%" align="right" cellpadding="2" cellspacing="1" border="0" bgcolor="#CCCCC0">
		<tr>
			<td colspan="7" align="center" class="titulocolumna">
				<bean:message key="label.purchases.instructions.edit.commitment.purchase.detail"/>
			</td>
		</tr>
		<tr class="columnadatoPar">
			<td align="right" colspan="2">
				<bean:message key="label.instructionsforecast.totals"/>
			</td>
			<td align="right">
				<input type="text" name="ipdView.itemQuantity" size="8" value="" readonly="readonly" id="itemQuantity" class="campo_texto_r">
			</td>
			<td align="right">
				<input type="text" name="ipdView.cornQuantity" size="8" value="" readonly="readonly" id="cornQuantity" class="campo_texto_r">
			</td>
			<td align="left" colspan="3">
				<input type="text" name="futuresReqTotal" id="futuresReqTotal" readonly="readonly" size="2" class="campo_texto_r"/>
			</td>
		</tr>
		<tr>
			<td class="titulocolumna" align="center" width="4%">&nbsp;</td>
			<td class="titulocolumna" align="center" width="16%">
				<bean:message key="label.instructionsforecast.period"/>
			</td>	
			<td class="titulocolumna" align="center" width="17%">
				<bean:message key="label.instructionsforecast.quantity"/>
			</td>	
			<td class="titulocolumna" align="center" width="20%">
				<bean:message key="label.instructionsforecast.quantity.corn"/>
			</td>	
			<td class="titulocolumna" align="center" colspan="2">
				<bean:message key="label.instructionsforecast.futures"/>
			</td>	
			<td class="titulocolumna" align="center" width="17%">
				<bean:message key="label.instructionsforecast.current"/>
			</td>
		</tr>
		<logic:present name="InstructionsForecastsViews">
			<c:forEach items="${InstructionsForecastsViews}" var="detail" varStatus="loop">
				<input type="hidden" id='quantity' name='quantity'  value='<c:out value="${detail.contracted}" />'/>
				<input type="hidden" id='quantityCorn' name='quantityCorn'  value='<c:out value="${detail.cornContracted}" />'/>
				<input type="hidden" id='futuresReq' name='futuresReq'  value='<c:out value="${detail.futures}" />'/>
				<tr <c:if test="${(loop.index%2)==0}"> class="columnadatoPar"</c:if> <c:if test="${(loop.index%2)!=0}">class="columnadatoNon"</c:if>>
					<td>
						<input type='checkbox' onclick="sumQuantity(this.form);"  id="instructionForecastCheck" name='ipdView.instructionsForecastsDetailView.checked'  <c:if test="${detail.forecastAdded==1}" ><c:out value="checked"/></c:if> value='<c:out value="${loop.index}"/>' />
					</td>
					<td align="center">
						<a href="showForecastByPeriod.do?month=<c:out value="${detail.month}" />&year=<c:out value="${detail.year}" />&customerId=<c:out value="${detail.customerId}" />&instructionPurchaseDetailId=-1">
							<c:out value="${detail.year}" />.<fmt:formatNumber maxIntegerDigits="2" minIntegerDigits="2" pattern="##" value="${detail.month}"></fmt:formatNumber>
						</a>
					</td>
					<td  align="right">
						<c:out value="${detail.contracted}" />
					</td>
					<td  align="right">
						<c:out value="${detail.cornContracted}" />
					</td>
					<td width="10%" align="right">
						<c:out value="${detail.futuresFloored}" />
					</td>
					<td width="14%"  align="right">
						(<c:out value="${detail.futures}" />)
					</td>
					<td  align="right">
						<c:if test="${detail.forecastAdded==1}" ><c:out value="${detail.actual}" /></c:if>
					</td>
				</tr>
			</c:forEach>
		</logic:present>
	</table>
</span>